home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AppleScript / Development Tools / Interfaces / AppleScript 1.1 Interfaces / CIncludes / OSA.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-27  |  52.3 KB  |  2,228 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        OSA.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __OSA__
  13. #define __OSA__
  14.  
  15. #ifndef __APPLEEVENTS__
  16. #include <AppleEvents.h>
  17. /*    #include <Types.h>                                            */
  18. /*        #include <ConditionalMacros.h>                            */
  19. /*        #include <MixedMode.h>                                    */
  20. /*            #include <Traps.h>                                    */
  21. /*    #include <Memory.h>                                            */
  22. /*    #include <OSUtils.h>                                        */
  23. /*    #include <Events.h>                                            */
  24. /*        #include <Quickdraw.h>                                    */
  25. /*            #include <QuickdrawText.h>                            */
  26. /*                #include <IntlResources.h>                        */
  27. /*    #include <EPPC.h>                                            */
  28. /*        #include <PPCToolBox.h>                                    */
  29. /*            #include <AppleTalk.h>                                */
  30. /*        #include <Processes.h>                                    */
  31. /*            #include <Files.h>                                    */
  32. /*                #include <SegLoad.h>                            */
  33. /*    #include <Notification.h>                                    */
  34. #endif
  35.  
  36. #ifndef __AEOBJECTS__
  37. #include <AEObjects.h>
  38. #endif
  39.  
  40. #ifndef __COMPONENTS__
  41. #include <Components.h>
  42. #endif
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47.  
  48. #ifndef OSAComponentFunctionInline
  49. #define OSAComponentFunctionInline(a, b) ComponentCallNow(a, b)
  50.  
  51. #endif
  52.  
  53. enum  {
  54. /*    The componenent manager type code for components that
  55.         support the OSA interface defined here. */
  56.     kOSAComponentType            = 0x6f736120,                    //  'osa '  //
  57.     kOSAGenericScriptingComponentSubtype = 0x73637074,            //  'scpt'  //
  58. /*    Type of script document files.    */
  59.     kOSAFileType                = 0x6f736173,                    //  'osas'  //
  60. /*     Suite and event code of the RecordedText event. 
  61.         (See OSAStartRecording, below.) */
  62.     kOSASuite                    = 0x61736372,                    //  'ascr'  //
  63.     kOSARecordedText            = 0x72656364,                    //  'recd'  //
  64. // Selector returns boolean.
  65.     kOSAScriptIsModified        = 0x6d6f6469,                    //  'modi'  //
  66. // Selector returns boolean.
  67.     kOSAScriptIsTypeCompiledScript = 0x63736372,                //  'cscr'  //
  68. // Selector returns boolean.
  69.     kOSAScriptIsTypeScriptValue    = 0x76616c75,                    //  'valu'  //
  70. // Selector returns boolean.
  71.     kOSAScriptIsTypeScriptContext = 0x636e7478,                    //  'cntx'  //
  72. // Selector returns a DescType which may be passed to OSACoerceToDesc.
  73.     kOSAScriptBestType            = 0x62657374,                    //  'best'  //
  74. /*  This selector is used to determine whether a script has source 
  75.         associated with it that when given to OSAGetSource, the call will not
  76.         fail.  The selector returns a boolean. */
  77.     kOSACanGetSource            = 0x67737263                    //  'gsrc'  //
  78. };
  79.  
  80. enum  {
  81.     typeOSADialectInfo            = 0x6469666f,                    //  'difo'  //
  82.     keyOSADialectName            = 0x646e616d,                    //  'dnam'  //
  83.     keyOSADialectCode            = 0x64636f64,                    //  'dcod'  //
  84.     keyOSADialectLangCode        = 0x646c6364,                    //  'dlcd'  //
  85.     keyOSADialectScriptCode        = 0x64736364                    //  'dscd'  //
  86. };
  87.  
  88. typedef ComponentResult OSAError;
  89.  
  90.  
  91. // Under the Open Scripting Architecture all error results are longs.
  92.  
  93. typedef unsigned long OSAID;
  94.  
  95.  
  96. /*     OSAIDs allow transparent manipulation of scripts associated with
  97.          various scripting systems. */
  98.  
  99. #define kOSANullScript ((OSAID) 0)
  100.  
  101. enum  {
  102.     kOSANullMode                = 0,                            // sounds better
  103.     kOSAModeNull                = 0                                // tastes consistent
  104. };
  105.  
  106.  
  107. /*     Some routines take flags that control their execution.  This constant
  108.         declares default mode settings are used. */
  109.  
  110. typedef pascal OSErr (*OSACreateAppleEventProcPtr)(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc *target, short returnID, long transactionID, AppleEvent *result, long refCon);
  111.  
  112. enum {
  113.     uppOSACreateAppleEventProcInfo = kPascalStackBased
  114.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  115.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEEventClass)))
  116.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEEventID)))
  117.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEAddressDesc*)))
  118.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  119.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
  120.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AppleEvent*)))
  121.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(long)))
  122. };
  123.  
  124. #if USESROUTINEDESCRIPTORS
  125. typedef UniversalProcPtr OSACreateAppleEventUPP;
  126.  
  127. #define CallOSACreateAppleEventProc(userRoutine, theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon)        \
  128.         CallUniversalProc((UniversalProcPtr)userRoutine, uppOSACreateAppleEventProcInfo, theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon)
  129. #define NewOSACreateAppleEventProc(userRoutine)        \
  130.         (OSACreateAppleEventUPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppOSACreateAppleEventProcInfo, GetCurrentISA())
  131. #else
  132. typedef OSACreateAppleEventProcPtr OSACreateAppleEventUPP;
  133.  
  134. #define CallOSACreateAppleEventProc(userRoutine, theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon)        \
  135.         (*userRoutine)(theAEEventClass, theAEEventID, target, returnID, transactionID, result, refCon)
  136. #define NewOSACreateAppleEventProc(userRoutine)        \
  137.         (OSACreateAppleEventUPP)(userRoutine)
  138. #endif
  139.  
  140. typedef pascal OSErr (*OSASendProcPtr)(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc, long refCon);
  141.  
  142. enum {
  143.     uppOSASendProcInfo = kPascalStackBased
  144.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  145.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AppleEvent*)))
  146.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent*)))
  147.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AESendMode)))
  148.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AESendPriority)))
  149.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
  150.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AEIdleProcPtr)))
  151.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(AEFilterProcPtr)))
  152.          | STACK_ROUTINE_PARAMETER(8, SIZE_CODE(sizeof(long)))
  153. };
  154.  
  155. #if USESROUTINEDESCRIPTORS
  156. typedef UniversalProcPtr OSASendUPP;
  157.  
  158. #define CallOSASendProc(userRoutine, theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon)        \
  159.         CallUniversalProc((UniversalProcPtr)userRoutine, uppOSASendProcInfo, theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon)
  160. #define NewOSASendProc(userRoutine)        \
  161.         (OSASendUPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppOSASendProcInfo, GetCurrentISA())
  162. #else
  163. typedef OSASendProcPtr OSASendUPP;
  164.  
  165. #define CallOSASendProc(userRoutine, theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon)        \
  166.         (*userRoutine)(theAppleEvent, reply, sendMode, sendPriority, timeOutInTicks, idleProc, filterProc, refCon)
  167. #define NewOSASendProc(userRoutine)        \
  168.         (OSASendUPP)(userRoutine)
  169. #endif
  170.  
  171.  
  172. ////////////////////////////////////////////////////////////////////////////////
  173.  
  174.  
  175. // API Errors
  176.  
  177.  
  178. ////////////////////////////////////////////////////////////////////////////////
  179.  
  180. enum  {
  181.     errOSASystemError            = -1750,
  182.     errOSAInvalidID                = -1751,
  183.     errOSABadStorageType        = -1752,
  184.     errOSAScriptError            = -1753,
  185.     errOSABadSelector            = -1754,
  186.     errOSASourceNotAvailable    = -1756,
  187.     errOSANoSuchDialect            = -1757,
  188.     errOSADataFormatObsolete    = -1758,
  189.     errOSADataFormatTooNew        = -1759,
  190.     errOSACorruptData            = errAECorruptData,
  191.     errOSARecordingIsAlreadyOn    = errAERecordingIsAlreadyOn
  192. };
  193.  
  194.  
  195. ////////////////////////////////////////////////////////////////////////////////
  196.  
  197.  
  198. // Standard Script Errors
  199.  
  200.  
  201. ////////////////////////////////////////////////////////////////////////////////
  202.  
  203.  
  204. // It is recommended that scripting components use the following set of error
  205.  
  206.  
  207. // codes to signal failure when applicable.  This enables applications that
  208.  
  209.  
  210. // use the OSA API to deal with some class of script errors in a less than 
  211.  
  212.  
  213. // ad hoc manner.  Scripting components are of course encouraged to return
  214.  
  215.  
  216. // component-specific errors when these don't apply.
  217.  
  218.  
  219. ////////////////////////////////////////////////////////////////////////////////
  220.  
  221.  
  222. //////// Dynamic errors:
  223.  
  224.  
  225. //
  226.  
  227.  
  228. // These errors result from data-dependent conditions and are typically
  229.  
  230.  
  231. // signaled at runtime.
  232.  
  233. enum  {
  234. /* Signaled when a value can't be coerced to the desired type. Similar
  235.        to errOSATypeError except results from coercion. */
  236.     errOSACantCoerce            = errAECoercionFail,
  237. // Signaled when an object is not found in a container.
  238.     errOSACantAccess            = errAENoSuchObject,
  239. /* Signaled when an object cannot be set in a container.  Same as 
  240.        AERegistry error errAEWriteDenied. */
  241.     errOSACantAssign            = -10006,
  242. /* Signaled by user scripts or applications when no actual error code
  243.        is to be returned.  Simply means "an error has occurred".  Most useful
  244.        in conjunction with an error message from the application. */
  245.     errOSAGeneralError            = -2700,
  246. // Signaled when there is an attempt to divide by zero.
  247.     errOSADivideByZero            = -2701,
  248. // Signaled when integer or real value is too large to be represented.
  249.     errOSANumericOverflow        = -2702,
  250. /* Signaled when application can't be launched or when it is remote and
  251.        program linking is not enabled. */
  252.     errOSACantLaunch            = -2703,
  253. // Signaled when an application can't respond to AppleEvents.
  254.     errOSAAppNotHighLevelEventAware = -2704,
  255. // Signaled when an application's terminology resource is not readable.
  256.     errOSACorruptTerminology    = -2705,
  257. // Signaled when the runtime stack overflows.
  258.     errOSAStackOverflow            = -2706,
  259. // Signaled when a runtime internal data structure overflows.
  260.     errOSAInternalTableOverflow    = -2707,
  261. /* Signaled when an intrinsic limitation is exceeded for the size of 
  262.        a value or data structure. */
  263.     errOSADataBlockTooLarge        = -2708,
  264.     errOSACantGetTerminology    = -2709,
  265.     errOSACantCreate            = -2710
  266. };
  267.  
  268.  
  269. //////// Component-specific dynamic script errors:
  270.  
  271.  
  272. //
  273.  
  274.  
  275. // The range -2720 thru -2739 is reserved for component-specific runtime errors.
  276.  
  277.  
  278. // (Note that error codes from different scripting components in this range will
  279.  
  280.  
  281. // overlap.)
  282.  
  283.  
  284. //////// Static errors:
  285.  
  286.  
  287. //
  288.  
  289.  
  290. // These errors comprise what are commonly thought of as parse and compile-
  291.  
  292.  
  293. // time errors.  However, in a dynamic system (e.g. AppleScript) any or all
  294.  
  295.  
  296. // of these may also occur at runtime.
  297.  
  298. enum  {
  299. // Signaled when data was not the right type and coercion is not allowed.
  300.     errOSATypeError                = errAEWrongDataType,
  301. // Signaled when a message was sent to an object that didn't handle it.
  302.     errOSAMessageNotUnderstood    = errAEEventNotHandled,
  303. /* Signaled when a function to be returned doesn't exist.  (Probably only
  304.        useful in languages with first-class functions that distinguish between
  305.        functions and other values (two name spaces). This is different from
  306.        errOSAMessageNotUnderstood, which may be signaled when the method is
  307.        invoked. */
  308.     errOSAUndefinedHandler        = errAEHandlerNotFound,
  309. // Signaled when a container can never have the requested object.
  310.     errOSAIllegalAccess            = errAEAccessorNotFound,
  311. // Signaled when index was out of range. Specialization of errOSACantAccess.
  312.     errOSAIllegalIndex            = errAEIllegalIndex,
  313. // Signaled when a range is screwy. Specialization of errOSACantAccess.
  314.     errOSAIllegalRange            = errAEImpossibleRange,
  315. /* Signaled when an object can never be set in a container.  Same as 
  316.        AERegistry error errAENotModifiable. */
  317.     errOSAIllegalAssign            = -10003,
  318. /* Signaled when a syntax error occurs. (e.g. "Syntax error" or
  319.        "<this> can't go after <that>"). */
  320.     errOSASyntaxError            = -2740,
  321. /* Signaled when another form of syntax was expected. (e.g. "expected
  322.        a <type> but found <this>"). */
  323.     errOSASyntaxTypeError        = -2741,
  324. // Signaled when a name or number is too long to be parsed.
  325.     errOSATokenTooLong            = -2742,
  326. /* Signaled when a parameter is missing for a function invocation.  Note
  327.        that in some languages, this error may occur at runtime. */
  328.     errOSAMissingParameter        = errAEDescNotFound,
  329. /* Signaled when function is called with the wrong number of parameters,
  330.        or a parameter pattern cannot be matched. */
  331.     errOSAParameterMismatch        = errAEWrongNumberArgs,
  332. /* Signaled when a formal parameter, local variable, or instance variable
  333.        is specified more than once. */
  334.     errOSADuplicateParameter    = -2750,
  335. /* Signaled when a formal parameter, local variable, or instance variable
  336.        is specified more than once. */
  337.     errOSADuplicateProperty        = -2751,
  338. /* Signaled when more than one handler is defined with the same name in 
  339.        a scope where the language doesn't allow it. */
  340.     errOSADuplicateHandler        = -2752,
  341. // Signaled when a variable is accessed that has no value.
  342.     errOSAUndefinedVariable        = -2753,
  343. /* Signaled when a variable is declared inconsistently in the same scope,
  344.        such as both local and global. */
  345.     errOSAInconsistentDeclarations = -2754,
  346. /* Signaled when illegal control flow occurs in an application (no catcher
  347.        for throw, non-lexical loop exit, etc.). */
  348.     errOSAControlFlowError        = -2755
  349. };
  350.  
  351.  
  352. //////// Component-specific static script errors:
  353.  
  354.  
  355. //
  356.  
  357.  
  358. // The range -2760 thru -2779 is reserved for component-specific parsing and
  359.  
  360.  
  361. // compile-time errors. (Note that error codes from different scripting
  362.  
  363.  
  364. // components in this range will overlap.)
  365.  
  366.  
  367. //////// Dialect-specific script errors:
  368.  
  369.  
  370. //
  371.  
  372.  
  373. // The range -2780 thru -2799 is reserved for dialect specific error codes for
  374.  
  375.  
  376. // scripting components that support dialects. (Note that error codes from
  377.  
  378.  
  379. // different scripting components in this range will overlap, as well as error
  380.  
  381.  
  382. // codes from different dialects in the same scripting component.)
  383.  
  384.  
  385. ////////////////////////////////////////////////////////////////////////////////
  386.  
  387.  
  388. // OSA Interface Descriptions
  389.  
  390.  
  391. ////////////////////////////////////////////////////////////////////////////////
  392.  
  393.  
  394. // The OSA Interface is broken down into a required interface, and several
  395.  
  396.  
  397. // optional interfaces to support additional functionality.  A given scripting
  398.  
  399.  
  400. // component may choose to support only some of the optional interfaces in
  401.  
  402.  
  403. // addition to the basic interface.  The OSA Component Flags may be used to 
  404.  
  405.  
  406. // query the Component Manager to find a scripting component with a particular
  407.  
  408.  
  409. // capability, or determine if a particular scripting component supports a 
  410.  
  411.  
  412. // particular capability.
  413.  
  414.  
  415. ////////////////////////////////////////////////////////////////////////////////
  416.  
  417.  
  418. //////// OSA Component Flags:
  419.  
  420. enum  {
  421.     kOSASupportsCompiling        = 0x0002,
  422.     kOSASupportsGetSource        = 0x0004,
  423.     kOSASupportsAECoercion        = 0x0008,
  424.     kOSASupportsAESending        = 0x0010,
  425.     kOSASupportsRecording        = 0x0020,
  426.     kOSASupportsConvenience        = 0x0040,
  427.     kOSASupportsDialects        = 0x0080,
  428.     kOSASupportsEventHandling    = 0x0100
  429. };
  430.  
  431.  
  432. //////// Component Selectors:
  433.  
  434. #define kOSASelectLoad 0x0001
  435.  
  436. #define kOSASelectStore 0x0002
  437.  
  438. #define kOSASelectExecute 0x0003
  439.  
  440. #define kOSASelectDisplay 0x0004
  441.  
  442. #define kOSASelectScriptError 0x0005
  443.  
  444. #define kOSASelectDispose 0x0006
  445.  
  446. #define kOSASelectSetScriptInfo 0x0007
  447.  
  448. #define kOSASelectGetScriptInfo 0x0008
  449.  
  450. #define kOSASelectSetActiveProc 0x0009
  451.  
  452. #define kOSASelectGetActiveProc 0x000A
  453.  
  454. #define kOSASelectScriptingComponentName 0x0102
  455.  
  456. #define kOSASelectCompile 0x0103
  457.  
  458. #define kOSASelectCopyID 0x0104
  459.  
  460. #define kOSASelectGetSource 0x0201
  461.  
  462. #define kOSASelectCoerceFromDesc 0x0301
  463.  
  464. #define kOSASelectCoerceToDesc 0x0302
  465.  
  466. #define kOSASelectSetSendProc 0x0401
  467.  
  468. #define kOSASelectGetSendProc 0x0402
  469.  
  470. #define kOSASelectSetCreateProc 0x0403
  471.  
  472. #define kOSASelectGetCreateProc 0x0404
  473.  
  474. #define kOSASelectSetDefaultTarget 0x0405
  475.  
  476. #define kOSASelectStartRecording 0x0501
  477.  
  478. #define kOSASelectStopRecording 0x0502
  479.  
  480. #define kOSASelectLoadExecute 0x0601
  481.  
  482. #define kOSASelectCompileExecute 0x0602
  483.  
  484. #define kOSASelectDoScript 0x0603
  485.  
  486. #define kOSASelectSetCurrentDialect 0x0701
  487.  
  488. #define kOSASelectGetCurrentDialect 0x0702
  489.  
  490. #define kOSASelectAvailableDialects 0x0703
  491.  
  492. #define kOSASelectGetDialectInfo 0x0704
  493.  
  494. #define kOSASelectAvailableDialectCodeList 0x0705
  495.  
  496. #define kOSASelectSetResumeDispatchProc 0x0801
  497.  
  498. #define kOSASelectGetResumeDispatchProc 0x0802
  499.  
  500. #define kOSASelectExecuteEvent 0x0803
  501.  
  502. #define kOSASelectDoEvent 0x0804
  503.  
  504. #define kOSASelectMakeContext 0x0805
  505.  
  506. #define kOSASelectComponentSpecificStart 0x1001
  507.  
  508. enum  {
  509. /* This mode flag may be passed to OSALoad, OSAStore or OSACompile to
  510.        instruct the scripting component to not retain the "source" of an
  511.        expression.  This will cause the OSAGetSource call to return the error
  512.        errOSASourceNotAvailable if used.  However, some scripting components
  513.        may not retain the source anyway.  This is mainly used when either space
  514.        efficiency is desired, or a script is to be "locked" so that its
  515.        implementation may not be viewed. */
  516.     kOSAModePreventGetSource    = 0x00000001,
  517. /* These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
  518.        OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  519.        indicate whether or not the script may interact with the user, switch
  520.        layer or reconnect if necessary.  Any AppleEvents will be sent with the
  521.        corresponding AESend mode supplied. */
  522.     kOSAModeNeverInteract        = kAENeverInteract,
  523.     kOSAModeCanInteract            = kAECanInteract,
  524.     kOSAModeAlwaysInteract        = kAEAlwaysInteract,
  525.     kOSAModeDontReconnect        = kAEDontReconnect,
  526. /* This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  527.        OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  528.        indicate whether or not AppleEvents should be sent with the
  529.        kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
  530.        opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
  531.        provide a more convenient default, i.e. not supplying any mode
  532.        (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
  533.        the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
  534.        without kAECanSwitchLayer. */
  535.     kOSAModeCantSwitchLayer        = 0x00000040,
  536. /* This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  537.        OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  538.        indicate whether or not AppleEvents should be sent with the kAEDontRecord
  539.        mode flag sent or not. NOTE: This flag is exactly the opposite sense of
  540.        the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
  541.        default, i.e. not supplying any mode (kOSAModeNull) means to send events
  542.        with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will 
  543.        cause AESend to be called without kAEDontRecord. */
  544.     kOSAModeDoRecord            = 0x00001000,
  545. /* This is a mode flag for OSACompile that indicates that a context should
  546.        be created as the result of compilation. All handler definitions are
  547.        inserted into the new context, and variables are initialized by
  548.        evaluating their initial values in a null context (i.e. they must be
  549.        constant expressions). */
  550.     kOSAModeCompileIntoContext    = 0x00000002,
  551. /* This is a mode flag for OSACompile that indicates that the previous
  552.        script ID (input to OSACompile) should be augmented with any new
  553.        definitions in the sourceData rather than replaced with a new script.
  554.        This means that the previous script ID must designate a context.
  555.        The presence of this flag causes the kOSAModeCompileIntoContext flag
  556.        to be implicitly used, causing any new definitions to be initialized
  557.        in a null context. */
  558.     kOSAModeAugmentContext        = 0x00000004,
  559. /* This mode flag may be passed to OSADisplay or OSADoScript to indicate
  560.        that output only need be human-readable, not re-compilable by OSACompile.
  561.        If used, output may be arbitrarily "beautified", e.g. quotes may be left
  562.        off of string values, long lists may have elipses, etc. */
  563.     kOSAModeDisplayForHumans    = 0x00000008,
  564. /* This mode flag may be passed to OSAStore in the case where the scriptID
  565.        is a context.  This causes the context to be saved, but not the context's
  566.        parent context.  When the stored context is loaded back in, the parent
  567.        will be kOSANullScript. */
  568.     kOSAModeDontStoreParent        = 0x00010000,
  569. /* This mode flag may be passed to OSAExecuteEvent to cause the event to
  570.        be dispatched to the direct object of the event. The direct object (or
  571.        subject attribute if the direct object is a non-object specifier) will
  572.        be resolved, and the resulting script object will be the recipient of
  573.        the message. The context argument to OSAExecuteEvent will serve as the
  574.        root of the lookup/resolution process. */
  575.     kOSAModeDispatchToDirectObject = 0x00020000,
  576. /* This mode flag may be passed to OSAExecuteEvent to indicate that
  577.        components do not have to get the data of object specifier arguments. */
  578.     kOSAModeDontGetDataForArguments = 0x00040000
  579. };
  580.  
  581.  
  582. ////////////////////////////////////////////////////////////////////////////////
  583.  
  584.  
  585. // OSA Basic Scripting Interface
  586.  
  587.  
  588. ////////////////////////////////////////////////////////////////////////////////
  589.  
  590.  
  591. // Scripting components must at least support the Basic Scripting interface.
  592.  
  593.  
  594. ////////////////////////////////////////////////////////////////////////////////
  595.  
  596.  
  597. //////// Loading and Storing Scripts:
  598.  
  599.  
  600. //
  601.  
  602.  
  603. // These routines allow scripts to be loaded and stored in their internal
  604.  
  605.  
  606. // (possibly compiled, non-text) representation.
  607.  
  608. enum  {
  609. // Resource type for scripts.
  610.     kOSAScriptResourceType        = kOSAGenericScriptingComponentSubtype,
  611. /* Default type given to OSAStore which creates "generic" loadable script
  612.        data descriptors. */
  613.     typeOSAGenericStorage        = kOSAScriptResourceType
  614. };
  615.  
  616. extern pascal OSAError OSALoad(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  617.  FIVEWORDINLINE(0x2F3C, 12, 0x0001, 0x7000, 0xA82A);
  618.  
  619. //
  620.  
  621.  
  622. // Errors:
  623.  
  624.  
  625. //    badComponentInstance    invalid scripting component instance
  626.  
  627.  
  628. //     errOSASystemError
  629.  
  630.  
  631. //     errOSABadStorageType:    scriptData not for this scripting component
  632.  
  633.  
  634. //     errOSACorruptData:        data seems to be corrupt
  635.  
  636.  
  637. //     errOSADataFormatObsolete    script data format is no longer supported
  638.  
  639.  
  640. //     errOSADataFormatTooNew        script data format is from a newer version
  641.  
  642.  
  643. // 
  644.  
  645.  
  646. // ModeFlags:
  647.  
  648.  
  649. //    kOSAModePreventGetSource
  650.  
  651. extern pascal OSAError OSAStore(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *resultingScriptData)
  652.  FIVEWORDINLINE(0x2F3C, 16, 0x0002, 0x7000, 0xA82A);
  653.  
  654. //
  655.  
  656.  
  657. // Errors:
  658.  
  659.  
  660. //    badComponentInstance    invalid scripting component instance
  661.  
  662.  
  663. //     errOSASystemError
  664.  
  665.  
  666. //     errOSAInvalidID
  667.  
  668.  
  669. //     errOSABadStorageType:    desiredType not for this scripting component
  670.  
  671.  
  672. // 
  673.  
  674.  
  675. // ModeFlags:
  676.  
  677.  
  678. //    kOSAModePreventGetSource
  679.  
  680.  
  681. //    kOSAModeDontStoreParent
  682.  
  683.  
  684. //////// Executing Scripts:
  685.  
  686. extern pascal OSAError OSAExecute(ComponentInstance scriptingComponent, OSAID compiledScriptID, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  687.  FIVEWORDINLINE(0x2F3C, 16, 0x0003, 0x7000, 0xA82A);
  688.  
  689. // This call runs a script.  The contextID represents the environment
  690.  
  691.  
  692. // with which global variables in the script are resolved.  The constant
  693.  
  694.  
  695. // kOSANullScript may be used for the contextID if the application wishes
  696.  
  697.  
  698. // to not deal with context directly (a default one is associated with each
  699.  
  700.  
  701. // scripting component instance).  The resultingScriptValueID is the 
  702.  
  703.  
  704. // result of evaluation, and contains a value which may be displayed using
  705.  
  706.  
  707. // the OSAGetSource call.  The modeFlags convey scripting component
  708.  
  709.  
  710. // specific information.
  711.  
  712.  
  713. //
  714.  
  715.  
  716. // Errors:
  717.  
  718.  
  719. //    badComponentInstance    invalid scripting component instance
  720.  
  721.  
  722. //     errOSASystemError
  723.  
  724.  
  725. //     errOSAInvalidID
  726.  
  727.  
  728. //     errOSAScriptError:        the executing script got an error
  729.  
  730.  
  731. //
  732.  
  733.  
  734. // ModeFlags:
  735.  
  736.  
  737. //    kOSAModeNeverInteract
  738.  
  739.  
  740. //    kOSAModeCanInteract
  741.  
  742.  
  743. //    kOSAModeAlwaysInteract
  744.  
  745.  
  746. //    kOSAModeCantSwitchLayer
  747.  
  748.  
  749. //    kOSAModeDontReconnect
  750.  
  751.  
  752. //    kOSAModeDoRecord
  753.  
  754.  
  755. //////// Displaying results:
  756.  
  757. extern pascal OSAError OSADisplay(ComponentInstance scriptingComponent, OSAID scriptValueID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  758.  FIVEWORDINLINE(0x2F3C, 16, 0x0004, 0x7000, 0xA82A);
  759.  
  760. // This call is used to convert results (script value IDs) into displayable
  761.  
  762.  
  763. // text. The desiredType should be at least typeChar, and modeFlags are
  764.  
  765.  
  766. // scripting system specific flags to control the formatting of the
  767.  
  768.  
  769. // resulting text. This call differs from OSAGetSource in that (1) it
  770.  
  771.  
  772. // always produces at least typeChar, (2) is only works on script values,
  773.  
  774.  
  775. // (3) it may display it's output in non-compilable form (e.g. without
  776.  
  777.  
  778. // string quotes, elipses inserted in long and/or circular lists, etc.) and
  779.  
  780.  
  781. // (4) it is required by the basic scripting interface.
  782.  
  783.  
  784. //
  785.  
  786.  
  787. // Errors:
  788.  
  789.  
  790. //    badComponentInstance    invalid scripting component instance
  791.  
  792.  
  793. //     errOSASystemError
  794.  
  795.  
  796. //     errOSAInvalidID
  797.  
  798.  
  799. //     errAECoercionFail:        desiredType not supported by scripting component
  800.  
  801.  
  802. //
  803.  
  804.  
  805. // ModeFlags:
  806.  
  807.  
  808. //    kOSAModeDisplayForHumans
  809.  
  810.  
  811. //////// Getting Error Information:
  812.  
  813. extern pascal OSAError OSAScriptError(ComponentInstance scriptingComponent, OSType selector, DescType desiredType, AEDesc *resultingErrorDescription)
  814.  FIVEWORDINLINE(0x2F3C, 12, 0x0005, 0x7000, 0xA82A);
  815.  
  816. // Whenever script execution returns errOSAExecutionError, this routine
  817.  
  818.  
  819. // may be used to get information about that error.  The selector describes
  820.  
  821.  
  822. // the type of information desired about the error (various selectors are
  823.  
  824.  
  825. // listed below).  The desiredType indicates the data type of the result
  826.  
  827.  
  828. // desired for that selector.
  829.  
  830.  
  831. //
  832.  
  833.  
  834. // Errors:
  835.  
  836.  
  837. //    badComponentInstance    invalid scripting component instance
  838.  
  839.  
  840. //     errOSASystemError
  841.  
  842.  
  843. //    errOSABadSelector:        selector not supported by scripting component
  844.  
  845.  
  846. //     errAECoercionFail:        desiredType not supported by scripting component
  847.  
  848.  
  849. // OSAScriptError selectors:
  850.  
  851. enum  {
  852. /* This selector is used to determine the error number of a script error.
  853.        These error numbers may be either system error numbers, or error numbers
  854.        that are scripting component specific.
  855.        Required desiredTypes:    
  856.               typeShortInteger */
  857.     kOSAErrorNumber                = 'errn',
  858. /* This selector is used to determine the full error message associated
  859.        with the error number.  It should include the name of the application
  860.        which caused the error, as well as the specific error that occurred.
  861.        This selector is sufficient for simple error reporting (but see
  862.        kOSAErrorBriefMessage, below).
  863.        Required desiredTypes:
  864.             typeChar                    error message string */
  865.     kOSAErrorMessage            = 'errs',
  866. /* This selector is used to determine a brief error message associated with
  867.        the error number.  This message and should not mention the name of the
  868.        application which caused the error, any partial results or offending
  869.        object (see kOSAErrorApp, kOSAErrorPartialResult and
  870.        kOSAErrorOffendingObject, below).
  871.        Required desiredTypes:
  872.           typeChar                    brief error message string */
  873.     kOSAErrorBriefMessage        = 0x65727262,                    //  'errb'  //
  874. /* This selector is used to determine which application actually got the
  875.        error (if it was the result of an AESend), or the current application
  876.        if ....
  877.        Required desiredTypes:
  878.           typeProcessSerialNumber        PSN of the errant application
  879.           typeChar                    name of the errant application */
  880.     kOSAErrorApp                = 0x65726170,                    //  'erap'  //
  881. /* This selector is used to determine any partial result returned by an 
  882.        operation. If an AESend call failed, but a partial result was returned,
  883.        then the partial result may be returned as an AEDesc.
  884.        Required desiredTypes:
  885.           typeBest                    AEDesc of any partial result */
  886.     kOSAErrorPartialResult        = 0x70746c72,                    //  'ptlr'  //
  887. /* This selector is used to determine any object which caused the error
  888.        that may have been indicated by an application.  The result is an 
  889.        AEDesc.
  890.        Required desiredTypes:
  891.           typeBest                    AEDesc of any offending object */
  892.     kOSAErrorOffendingObject    = 0x65726f62,                    //  'erob'  //
  893. /* This selector is used to determine the type expected by a coercion 
  894.        operation if a type error occurred. */
  895.     kOSAErrorExpectedType        = 0x65727274,                    //  'errt'  //
  896. /* This selector is used to determine the source text range (start and 
  897.        end positions) of where the error occurred.
  898.        Required desiredTypes:
  899.           typeOSAErrorRange */
  900.     kOSAErrorRange                = 0x65726e67,                    //  'erng'  //
  901. /* An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
  902.         of type short. */
  903.     typeOSAErrorRange            = 0x65726e67,                    //  'erng'  //
  904. // Field of a typeOSAErrorRange record of typeShortInteger.
  905.     keyOSASourceStart            = 0x73726373,                    //  'srcs'  //
  906. // Field of a typeOSAErrorRange record of typeShortInteger.
  907.     keyOSASourceEnd                = 0x73726365                    //  'srce'  //
  908. };
  909.  
  910.  
  911. //////// Disposing Script IDs:
  912.  
  913. extern pascal OSAError OSADispose(ComponentInstance scriptingComponent, OSAID scriptID)
  914.  FIVEWORDINLINE(0x2F3C, 4, 0x0006, 0x7000, 0xA82A);
  915.  
  916. // Disposes a script or context.
  917.  
  918.  
  919. //
  920.  
  921.  
  922. // Errors:
  923.  
  924.  
  925. //    badComponentInstance    invalid scripting component instance
  926.  
  927.  
  928. //     errOSASystemError
  929.  
  930.  
  931. //     errOSAInvalidID
  932.  
  933.  
  934. //////// Getting and Setting Script Information:
  935.  
  936. extern pascal OSAError OSASetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long value)
  937.  FIVEWORDINLINE(0x2F3C, 12, 0x0007, 0x7000, 0xA82A);
  938.  
  939. //
  940.  
  941.  
  942. // Errors:
  943.  
  944.  
  945. //    badComponentInstance    invalid scripting component instance
  946.  
  947.  
  948. //     errOSASystemError
  949.  
  950.  
  951. //     errOSAInvalidID
  952.  
  953.  
  954. //    errOSABadSelector:        selector not supported by scripting component
  955.  
  956.  
  957. //                             or selector not for this scriptID
  958.  
  959. extern pascal OSAError OSAGetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long *result)
  960.  FIVEWORDINLINE(0x2F3C, 12, 0x0008, 0x7000, 0xA82A);
  961.  
  962. //
  963.  
  964.  
  965. // Errors:
  966.  
  967.  
  968. //    badComponentInstance    invalid scripting component instance
  969.  
  970.  
  971. //     errOSASystemError
  972.  
  973.  
  974. //     errOSAInvalidID
  975.  
  976.  
  977. //    errOSABadSelector:        selector not supported by scripting component
  978.  
  979.  
  980. //                             or selector not for this scriptID
  981.  
  982.  
  983. //////// Manipulating the ActiveProc:
  984.  
  985.  
  986. //
  987.  
  988.  
  989. // Scripting systems will supply default values for these procedures if they
  990.  
  991.  
  992. // are not set by the client:
  993.  
  994. typedef pascal OSErr (*OSAActiveProcPtr)(long refCon);
  995.  
  996. enum {
  997.     uppOSAActiveProcInfo = kPascalStackBased
  998.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  999.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  1000. };
  1001.  
  1002. #if USESROUTINEDESCRIPTORS
  1003. typedef UniversalProcPtr OSAActiveUPP;
  1004.  
  1005. #define CallOSAActiveProc(userRoutine, refCon)        \
  1006.         CallUniversalProc((UniversalProcPtr)userRoutine, uppOSAActiveProcInfo, refCon)
  1007. #define NewOSAActiveProc(userRoutine)        \
  1008.         (OSAActiveUPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppOSAActiveProcInfo, GetCurrentISA())
  1009. #else
  1010. typedef OSAActiveProcPtr OSAActiveUPP;
  1011.  
  1012. #define CallOSAActiveProc(userRoutine, refCon)        \
  1013.         (*userRoutine)(refCon)
  1014. #define NewOSAActiveProc(userRoutine)        \
  1015.         (OSAActiveUPP)(userRoutine)
  1016. #endif
  1017.  
  1018. extern pascal OSAError OSASetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP activeProc, long refCon)
  1019.  FIVEWORDINLINE(0x2F3C, 8, 0x0009, 0x7000, 0xA82A);
  1020.  
  1021. // If activeProc is nil, the default activeProc is used.
  1022.  
  1023.  
  1024. //
  1025.  
  1026.  
  1027. // Errors:
  1028.  
  1029.  
  1030. //    badComponentInstance    invalid scripting component instance
  1031.  
  1032.  
  1033. //     errOSASystemError
  1034.  
  1035. extern pascal OSAError OSAGetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP *activeProc, long *refCon)
  1036.  FIVEWORDINLINE(0x2F3C, 8, 0x000A, 0x7000, 0xA82A);
  1037.  
  1038. //
  1039.  
  1040.  
  1041. // Errors:
  1042.  
  1043.  
  1044. //    badComponentInstance    invalid scripting component instance
  1045.  
  1046.  
  1047. //     errOSASystemError
  1048.  
  1049.  
  1050. ////////////////////////////////////////////////////////////////////////////////
  1051.  
  1052.  
  1053. // OSA Optional Compiling Interface
  1054.  
  1055.  
  1056. ////////////////////////////////////////////////////////////////////////////////
  1057.  
  1058.  
  1059. // Scripting components that support the Compiling interface have the 
  1060.  
  1061.  
  1062. // kOSASupportsCompiling bit set in it's ComponentDescription.
  1063.  
  1064.  
  1065. ////////////////////////////////////////////////////////////////////////////////
  1066.  
  1067. extern pascal OSAError OSAScriptingComponentName(ComponentInstance scriptingComponent, AEDesc *resultingScriptingComponentName)
  1068.  FIVEWORDINLINE(0x2F3C, 4, 0x0102, 0x7000, 0xA82A);
  1069.  
  1070. // Given a scripting component, this routine returns the name of that
  1071.  
  1072.  
  1073. // scripting component in a type that is coercable to text (typeChar).
  1074.  
  1075.  
  1076. // The generic scripting component returns the name of the default
  1077.  
  1078.  
  1079. // scripting component.  This name should be sufficient to convey to the
  1080.  
  1081.  
  1082. // user the kind of script (syntax) he is expected to write.
  1083.  
  1084.  
  1085. //
  1086.  
  1087.  
  1088. // Errors:
  1089.  
  1090.  
  1091. //    badComponentInstance    invalid scripting component instance
  1092.  
  1093.  
  1094. //     errOSASystemError
  1095.  
  1096. extern pascal OSAError OSACompile(ComponentInstance scriptingComponent, const AEDesc *sourceData, long modeFlags, OSAID *previousAndResultingScriptID)
  1097.  FIVEWORDINLINE(0x2F3C, 12, 0x0103, 0x7000, 0xA82A);
  1098.  
  1099. // Coerces input desc (possibly text) into a script's internal format.
  1100.  
  1101.  
  1102. // Once compiled, the script is ready to run.  The modeFlags convey
  1103.  
  1104.  
  1105. // scripting component specific information.  The previous script ID
  1106.  
  1107.  
  1108. // (result parameter) is made to refer to the newly compiled script,
  1109.  
  1110.  
  1111. // unless it was originally kOSANullScript.  In this case a new script
  1112.  
  1113.  
  1114. // ID is created and used.
  1115.  
  1116.  
  1117. //
  1118.  
  1119.  
  1120. // Errors:
  1121.  
  1122.  
  1123. //    badComponentInstance    invalid scripting component instance
  1124.  
  1125.  
  1126. //     errOSASystemError
  1127.  
  1128.  
  1129. //    errAECoercionFail:        sourceData is not compilable
  1130.  
  1131.  
  1132. //     errOSAScriptError:        sourceData was a bad script (syntax error)
  1133.  
  1134.  
  1135. //     errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1136.  
  1137.  
  1138. //                            valid on input
  1139.  
  1140.  
  1141. //
  1142.  
  1143.  
  1144. // ModeFlags:
  1145.  
  1146.  
  1147. //    kOSAModePreventGetSource
  1148.  
  1149.  
  1150. //    kOSAModeCompileIntoContext
  1151.  
  1152.  
  1153. //    kOSAModeAugmentContext
  1154.  
  1155.  
  1156. //    kOSAModeNeverInteract
  1157.  
  1158.  
  1159. //    kOSAModeCanInteract
  1160.  
  1161.  
  1162. //    kOSAModeAlwaysInteract
  1163.  
  1164.  
  1165. //    kOSAModeCantSwitchLayer
  1166.  
  1167.  
  1168. //    kOSAModeDontReconnect
  1169.  
  1170.  
  1171. //    kOSAModeDoRecord
  1172.  
  1173. extern pascal OSAError OSACopyID(ComponentInstance scriptingComponent, OSAID fromID, OSAID *toID)
  1174.  FIVEWORDINLINE(0x2F3C, 8, 0x0104, 0x7000, 0xA82A);
  1175.  
  1176. // If toID is a reference to kOSANullScript then it is updated to have a
  1177.  
  1178.  
  1179. // new scriptID value.  This call can be used to perform undo or revert
  1180.  
  1181.  
  1182. // operations on scripts. 
  1183.  
  1184.  
  1185. //
  1186.  
  1187.  
  1188. // Errors:
  1189.  
  1190.  
  1191. //    badComponentInstance    invalid scripting component instance
  1192.  
  1193.  
  1194. //     errOSASystemError
  1195.  
  1196.  
  1197. //     errOSAInvalidID
  1198.  
  1199.  
  1200. ////////////////////////////////////////////////////////////////////////////////
  1201.  
  1202.  
  1203. // OSA Optional GetSource Interface
  1204.  
  1205.  
  1206. ////////////////////////////////////////////////////////////////////////////////
  1207.  
  1208.  
  1209. // Scripting components that support the GetSource interface have the 
  1210.  
  1211.  
  1212. // kOSASupportsGetSource bit set in it's ComponentDescription.
  1213.  
  1214.  
  1215. ////////////////////////////////////////////////////////////////////////////////
  1216.  
  1217. extern pascal OSAError OSAGetSource(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, AEDesc *resultingSourceData)
  1218.  FIVEWORDINLINE(0x2F3C, 12, 0x0201, 0x7000, 0xA82A);
  1219.  
  1220. // This routine causes a compiled script to be output in a form (possibly
  1221.  
  1222.  
  1223. // text) such that it is suitable to be passed back to OSACompile.
  1224.  
  1225.  
  1226. //
  1227.  
  1228.  
  1229. // Errors:
  1230.  
  1231.  
  1232. //    badComponentInstance    invalid scripting component instance
  1233.  
  1234.  
  1235. //     errOSASystemError
  1236.  
  1237.  
  1238. //     errOSAInvalidID
  1239.  
  1240.  
  1241. //    errOSASourceNotAvailable    can't get source for this scriptID
  1242.  
  1243.  
  1244. ////////////////////////////////////////////////////////////////////////////////
  1245.  
  1246.  
  1247. // OSA Optional AECoercion Interface
  1248.  
  1249.  
  1250. ////////////////////////////////////////////////////////////////////////////////
  1251.  
  1252.  
  1253. // Scripting components that support the AECoercion interface have the 
  1254.  
  1255.  
  1256. // kOSASupportsAECoercion bit set in it's ComponentDescription.
  1257.  
  1258.  
  1259. ////////////////////////////////////////////////////////////////////////////////
  1260.  
  1261. extern pascal OSAError OSACoerceFromDesc(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  1262.  FIVEWORDINLINE(0x2F3C, 12, 0x0301, 0x7000, 0xA82A);
  1263.  
  1264. // This routine causes script data to be coerced into a script value.
  1265.  
  1266.  
  1267. // If the scriptData is an AppleEvent, then the resultingScriptID is a
  1268.  
  1269.  
  1270. // compiled script ID (mode flags for OSACompile may be used in this case).
  1271.  
  1272.  
  1273. // Other scriptData descriptors create script value IDs.
  1274.  
  1275.  
  1276. //
  1277.  
  1278.  
  1279. // Errors:
  1280.  
  1281.  
  1282. //    badComponentInstance    invalid scripting component instance
  1283.  
  1284.  
  1285. //     errOSASystemError
  1286.  
  1287.  
  1288. //
  1289.  
  1290.  
  1291. // ModeFlags:
  1292.  
  1293.  
  1294. //    kOSAModePreventGetSource
  1295.  
  1296.  
  1297. //    kOSAModeCompileIntoContext
  1298.  
  1299.  
  1300. //    kOSAModeNeverInteract
  1301.  
  1302.  
  1303. //    kOSAModeCanInteract
  1304.  
  1305.  
  1306. //    kOSAModeAlwaysInteract
  1307.  
  1308.  
  1309. //    kOSAModeCantSwitchLayer
  1310.  
  1311.  
  1312. //    kOSAModeDontReconnect
  1313.  
  1314.  
  1315. //    kOSAModeDoRecord
  1316.  
  1317. extern pascal OSAError OSACoerceToDesc(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *result)
  1318.  FIVEWORDINLINE(0x2F3C, 16, 0x0302, 0x7000, 0xA82A);
  1319.  
  1320. // This routine causes a script value to be coerced into any desired form.
  1321.  
  1322.  
  1323. // If the scriptID denotes a compiled script, then it may be coerced to 
  1324.  
  1325.  
  1326. // typeAppleEvent.
  1327.  
  1328.  
  1329. //
  1330.  
  1331.  
  1332. // Errors:
  1333.  
  1334.  
  1335. //    badComponentInstance    invalid scripting component instance
  1336.  
  1337.  
  1338. //     errOSASystemError
  1339.  
  1340.  
  1341. //     errOSAInvalidID
  1342.  
  1343.  
  1344. ////////////////////////////////////////////////////////////////////////////////
  1345.  
  1346.  
  1347. // OSA Optional AESending Interface
  1348.  
  1349.  
  1350. ////////////////////////////////////////////////////////////////////////////////
  1351.  
  1352.  
  1353. // Scripting components that support the AESending interface have the 
  1354.  
  1355.  
  1356. // kOSASupportsAESending bit set in it's ComponentDescription.
  1357.  
  1358.  
  1359. ////////////////////////////////////////////////////////////////////////////////
  1360.  
  1361.  
  1362. // Scripting systems will supply default values for these procedures if they
  1363.  
  1364.  
  1365. // are not set by the client:
  1366.  
  1367. extern pascal OSAError OSASetSendProc(ComponentInstance scriptingComponent, OSASendUPP sendProc, long refCon)
  1368.  FIVEWORDINLINE(0x2F3C, 8, 0x0401, 0x7000, 0xA82A);
  1369.  
  1370. // If sendProc is nil, the default sendProc is used.
  1371.  
  1372.  
  1373. //
  1374.  
  1375.  
  1376. // Errors:
  1377.  
  1378.  
  1379. //    badComponentInstance    invalid scripting component instance
  1380.  
  1381.  
  1382. //     errOSASystemError
  1383.  
  1384. extern pascal OSAError OSAGetSendProc(ComponentInstance scriptingComponent, OSASendUPP *sendProc, long *refCon)
  1385.  FIVEWORDINLINE(0x2F3C, 8, 0x0402, 0x7000, 0xA82A);
  1386.  
  1387. //
  1388.  
  1389.  
  1390. // Errors:
  1391.  
  1392.  
  1393. //    badComponentInstance    invalid scripting component instance
  1394.  
  1395.  
  1396. //     errOSASystemError
  1397.  
  1398. extern pascal OSAError OSASetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP createProc, long refCon)
  1399.  FIVEWORDINLINE(0x2F3C, 8, 0x0403, 0x7000, 0xA82A);
  1400.  
  1401. // If createProc is nil, the default createProc is used.
  1402.  
  1403.  
  1404. //
  1405.  
  1406.  
  1407. // Errors:
  1408.  
  1409.  
  1410. //    badComponentInstance    invalid scripting component instance
  1411.  
  1412.  
  1413. //     errOSASystemError
  1414.  
  1415. extern pascal OSAError OSAGetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP *createProc, long *refCon)
  1416.  FIVEWORDINLINE(0x2F3C, 8, 0x0404, 0x7000, 0xA82A);
  1417.  
  1418. //
  1419.  
  1420.  
  1421. // Errors:
  1422.  
  1423.  
  1424. //    badComponentInstance    invalid scripting component instance
  1425.  
  1426.  
  1427. //     errOSASystemError
  1428.  
  1429. extern pascal OSAError OSASetDefaultTarget(ComponentInstance scriptingComponent, const AEAddressDesc *target)
  1430.  FIVEWORDINLINE(0x2F3C, 4, 0x0405, 0x7000, 0xA82A);
  1431.  
  1432. // This routine sets the default target application for AE sending.
  1433.  
  1434.  
  1435. // It also establishes the default target from which terminologies come.
  1436.  
  1437.  
  1438. // It is effectively like having an AppleScript "tell" statement around
  1439.  
  1440.  
  1441. // the entire program.  If this routine is not called, or if the target 
  1442.  
  1443.  
  1444. // is a null AEDesc, then the current application is the default target.
  1445.  
  1446.  
  1447. //
  1448.  
  1449.  
  1450. // Errors:
  1451.  
  1452.  
  1453. //    badComponentInstance    invalid scripting component instance
  1454.  
  1455.  
  1456. //     errOSASystemError
  1457.  
  1458.  
  1459. ////////////////////////////////////////////////////////////////////////////////
  1460.  
  1461.  
  1462. // OSA Optional Recording Interface
  1463.  
  1464.  
  1465. ////////////////////////////////////////////////////////////////////////////////
  1466.  
  1467.  
  1468. // Scripting components that support the Recording interface have the 
  1469.  
  1470.  
  1471. // kOSASupportsRecording bit set in it's ComponentDescription.
  1472.  
  1473.  
  1474. ////////////////////////////////////////////////////////////////////////////////
  1475.  
  1476. extern pascal OSAError OSAStartRecording(ComponentInstance scriptingComponent, OSAID *compiledScriptToModifyID)
  1477.  FIVEWORDINLINE(0x2F3C, 4, 0x0501, 0x7000, 0xA82A);
  1478.  
  1479. // Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
  1480.  
  1481.  
  1482. // new script ID is created and returned.  If the current application has
  1483.  
  1484.  
  1485. // a handler for the kOSARecordedText event, then kOSARecordedText events
  1486.  
  1487.  
  1488. // are sent to the application containing the text of each AppleEvent 
  1489.  
  1490.  
  1491. // recorded.
  1492.  
  1493.  
  1494. //
  1495.  
  1496.  
  1497. // Errors:
  1498.  
  1499.  
  1500. //    badComponentInstance    invalid scripting component instance
  1501.  
  1502.  
  1503. //     errOSASystemError
  1504.  
  1505.  
  1506. //     errOSAInvalidID
  1507.  
  1508.  
  1509. //    errOSARecordingIsAlreadyOn
  1510.  
  1511. extern pascal OSAError OSAStopRecording(ComponentInstance scriptingComponent, OSAID compiledScriptID)
  1512.  FIVEWORDINLINE(0x2F3C, 4, 0x0502, 0x7000, 0xA82A);
  1513.  
  1514. // If compiledScriptID is not being recorded into or recording is not
  1515.  
  1516.  
  1517. // currently on, no error is returned.
  1518.  
  1519.  
  1520. //
  1521.  
  1522.  
  1523. // Errors:
  1524.  
  1525.  
  1526. //    badComponentInstance    invalid scripting component instance
  1527.  
  1528.  
  1529. //     errOSASystemError
  1530.  
  1531.  
  1532. //     errOSAInvalidID
  1533.  
  1534.  
  1535. ////////////////////////////////////////////////////////////////////////////////
  1536.  
  1537.  
  1538. // OSA Optional Convenience Interface
  1539.  
  1540.  
  1541. ////////////////////////////////////////////////////////////////////////////////
  1542.  
  1543.  
  1544. // Scripting components that support the Convenience interface have the 
  1545.  
  1546.  
  1547. // kOSASupportsConvenience bit set in it's ComponentDescription.
  1548.  
  1549.  
  1550. ////////////////////////////////////////////////////////////////////////////////
  1551.  
  1552. extern pascal OSAError OSALoadExecute(ComponentInstance scriptingComponent, const AEDesc *scriptData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1553.  FIVEWORDINLINE(0x2F3C, 16, 0x0601, 0x7000, 0xA82A);
  1554.  
  1555. // This routine is effectively equivalent to calling OSALoad followed by
  1556.  
  1557.  
  1558. // OSAExecute.  After execution, the compiled source is disposed.  Only the
  1559.  
  1560.  
  1561. // resulting value ID is retained.
  1562.  
  1563.  
  1564. //
  1565.  
  1566.  
  1567. // Errors:
  1568.  
  1569.  
  1570. //    badComponentInstance    invalid scripting component instance
  1571.  
  1572.  
  1573. //     errOSASystemError
  1574.  
  1575.  
  1576. //     errOSABadStorageType:    scriptData not for this scripting component
  1577.  
  1578.  
  1579. //     errOSACorruptData:        data seems to be corrupt
  1580.  
  1581.  
  1582. //     errOSADataFormatObsolete    script data format is no longer supported
  1583.  
  1584.  
  1585. //     errOSADataFormatTooNew        script data format is from a newer version
  1586.  
  1587.  
  1588. //     errOSAInvalidID
  1589.  
  1590.  
  1591. //     errOSAScriptError:        the executing script got an error
  1592.  
  1593.  
  1594. //
  1595.  
  1596.  
  1597. // ModeFlags:
  1598.  
  1599.  
  1600. //    kOSAModeNeverInteract
  1601.  
  1602.  
  1603. //    kOSAModeCanInteract
  1604.  
  1605.  
  1606. //    kOSAModeAlwaysInteract
  1607.  
  1608.  
  1609. //    kOSAModeCantSwitchLayer
  1610.  
  1611.  
  1612. //    kOSAModeDontReconnect
  1613.  
  1614.  
  1615. //    kOSAModeDoRecord
  1616.  
  1617. extern pascal OSAError OSACompileExecute(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1618.  FIVEWORDINLINE(0x2F3C, 16, 0x0602, 0x7000, 0xA82A);
  1619.  
  1620. // This routine is effectively equivalent to calling OSACompile followed by
  1621.  
  1622.  
  1623. // OSAExecute.  After execution, the compiled source is disposed.  Only the
  1624.  
  1625.  
  1626. // resulting value ID is retained.
  1627.  
  1628.  
  1629. //
  1630.  
  1631.  
  1632. // Errors:
  1633.  
  1634.  
  1635. //    badComponentInstance    invalid scripting component instance
  1636.  
  1637.  
  1638. //     errOSASystemError
  1639.  
  1640.  
  1641. //    errAECoercionFail:        sourceData is not compilable
  1642.  
  1643.  
  1644. //     errOSAScriptError:        sourceData was a bad script (syntax error)
  1645.  
  1646.  
  1647. //     errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1648.  
  1649.  
  1650. //                            valid on input
  1651.  
  1652.  
  1653. //     errOSAScriptError:        the executing script got an error
  1654.  
  1655.  
  1656. //
  1657.  
  1658.  
  1659. // ModeFlags:
  1660.  
  1661.  
  1662. //    kOSAModeNeverInteract
  1663.  
  1664.  
  1665. //    kOSAModeCanInteract
  1666.  
  1667.  
  1668. //    kOSAModeAlwaysInteract
  1669.  
  1670.  
  1671. //    kOSAModeCantSwitchLayer
  1672.  
  1673.  
  1674. //    kOSAModeDontReconnect
  1675.  
  1676.  
  1677. //    kOSAModeDoRecord
  1678.  
  1679. extern pascal OSAError OSADoScript(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  1680.  FIVEWORDINLINE(0x2F3C, 20, 0x0603, 0x7000, 0xA82A);
  1681.  
  1682. // This routine is effectively equivalent to calling OSACompile followed by
  1683.  
  1684.  
  1685. // OSAExecute and then OSADisplay.  After execution, the compiled source
  1686.  
  1687.  
  1688. // and the resulting value are is disposed.  Only the resultingText
  1689.  
  1690.  
  1691. // descriptor is retained.  If a script error occur during processing, the 
  1692.  
  1693.  
  1694. // resultingText gets the error message of the error, and errOSAScriptError
  1695.  
  1696.  
  1697. // is returned.  OSAScriptError may still be used to extract more 
  1698.  
  1699.  
  1700. // information about the particular error.
  1701.  
  1702.  
  1703. //
  1704.  
  1705.  
  1706. // Errors:
  1707.  
  1708.  
  1709. //    badComponentInstance    invalid scripting component instance
  1710.  
  1711.  
  1712. //     errOSASystemError
  1713.  
  1714.  
  1715. //    errAECoercionFail:        sourceData is not compilable or 
  1716.  
  1717.  
  1718. //                            desiredType not supported by scripting component
  1719.  
  1720.  
  1721. //     errOSAScriptError:        sourceData was a bad script (syntax error)
  1722.  
  1723.  
  1724. //     errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1725.  
  1726.  
  1727. //                            valid on input
  1728.  
  1729.  
  1730. //     errOSAScriptError:        the executing script got an error
  1731.  
  1732.  
  1733. //
  1734.  
  1735.  
  1736. // ModeFlags:
  1737.  
  1738.  
  1739. //    kOSAModeNeverInteract
  1740.  
  1741.  
  1742. //    kOSAModeCanInteract
  1743.  
  1744.  
  1745. //    kOSAModeAlwaysInteract
  1746.  
  1747.  
  1748. //    kOSAModeCantSwitchLayer
  1749.  
  1750.  
  1751. //    kOSAModeDontReconnect
  1752.  
  1753.  
  1754. //    kOSAModeDoRecord
  1755.  
  1756.  
  1757. //    kOSAModeDisplayForHumans
  1758.  
  1759.  
  1760. ////////////////////////////////////////////////////////////////////////////////
  1761.  
  1762.  
  1763. // OSA Optional Dialects Interface
  1764.  
  1765.  
  1766. ////////////////////////////////////////////////////////////////////////////////
  1767.  
  1768.  
  1769. // Scripting components that support the Dialects interface have the 
  1770.  
  1771.  
  1772. // kOSASupportsDialects bit set in it's ComponentDescription.
  1773.  
  1774.  
  1775. ////////////////////////////////////////////////////////////////////////////////
  1776.  
  1777.  
  1778. // These calls allows an scripting component that supports different dialects
  1779.  
  1780.  
  1781. // to dynamically switch between those dialects.  Although this interface is
  1782.  
  1783.  
  1784. // specified, the particular dialect codes are scripting component dependent.
  1785.  
  1786. extern pascal OSAError OSASetCurrentDialect(ComponentInstance scriptingComponent, short dialectCode)
  1787.  FIVEWORDINLINE(0x2F3C, 2, 0x0701, 0x7000, 0xA82A);
  1788.  
  1789. //
  1790.  
  1791.  
  1792. // Errors:
  1793.  
  1794.  
  1795. //    badComponentInstance    invalid scripting component instance
  1796.  
  1797.  
  1798. //     errOSASystemError
  1799.  
  1800.  
  1801. //     errOSANoSuchDialect:    invalid dialectCode
  1802.  
  1803. extern pascal OSAError OSAGetCurrentDialect(ComponentInstance scriptingComponent, short *resultingDialectCode)
  1804.  FIVEWORDINLINE(0x2F3C, 4, 0x0702, 0x7000, 0xA82A);
  1805.  
  1806. //
  1807.  
  1808.  
  1809. // Errors:
  1810.  
  1811.  
  1812. //    badComponentInstance    invalid scripting component instance
  1813.  
  1814.  
  1815. //     errOSASystemError
  1816.  
  1817. extern pascal OSAError OSAAvailableDialects(ComponentInstance scriptingComponent, AEDesc *resultingDialectInfoList)
  1818.  FIVEWORDINLINE(0x2F3C, 4, 0x0703, 0x7000, 0xA82A);
  1819.  
  1820. // This call return an AEList containing information about each of the
  1821.  
  1822.  
  1823. // currently available dialects of a scripting component.  Each item
  1824.  
  1825.  
  1826. // is an AERecord of typeOSADialectInfo that contains at least the fields
  1827.  
  1828.  
  1829. // keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and 
  1830.  
  1831.  
  1832. // keyOSADialectScriptCode.
  1833.  
  1834.  
  1835. //
  1836.  
  1837.  
  1838. // Errors:
  1839.  
  1840.  
  1841. //    badComponentInstance    invalid scripting component instance
  1842.  
  1843.  
  1844. //     errOSASystemError
  1845.  
  1846. extern pascal OSAError OSAGetDialectInfo(ComponentInstance scriptingComponent, short dialectCode, OSType selector, AEDesc *resultingDialectInfo)
  1847.  FIVEWORDINLINE(0x2F3C, 10, 0x0704, 0x7000, 0xA82A);
  1848.  
  1849. // This call gives information about the specified dialect of a scripting
  1850.  
  1851.  
  1852. // component. It returns an AEDesc whose type depends on the selector 
  1853.  
  1854.  
  1855. // specified. Available selectors are the same as the field keys for a
  1856.  
  1857.  
  1858. // dialect info record. The type of AEDesc returned is the same as the 
  1859.  
  1860.  
  1861. // type of the field that has same key as the selector.
  1862.  
  1863.  
  1864. //
  1865.  
  1866.  
  1867. // Errors:
  1868.  
  1869.  
  1870. //    badComponentInstance    invalid scripting component instance
  1871.  
  1872.  
  1873. //     errOSASystemError
  1874.  
  1875.  
  1876. //  errOSABadSelector
  1877.  
  1878.  
  1879. //     errOSANoSuchDialect:    invalid dialectCode
  1880.  
  1881. extern pascal OSAError OSAAvailableDialectCodeList(ComponentInstance scriptingComponent, AEDesc *resultingDialectCodeList)
  1882.  FIVEWORDINLINE(0x2F3C, 4, 0x0705, 0x7000, 0xA82A);
  1883.  
  1884. // This is alternative to OSAGetAvailableDialectCodeList. Use this call
  1885.  
  1886.  
  1887. // and  OSAGetDialectInfo to get information on dialects.
  1888.  
  1889.  
  1890. // This call return an AEList containing dialect code for each of the
  1891.  
  1892.  
  1893. // currently available dialects of a scripting component. Each dialect
  1894.  
  1895.  
  1896. // code is a short integer of type typeShortInteger.
  1897.  
  1898.  
  1899. //
  1900.  
  1901.  
  1902. // Errors:
  1903.  
  1904.  
  1905. //    badComponentInstance    invalid scripting component instance
  1906.  
  1907.  
  1908. //     errOSASystemError
  1909.  
  1910.  
  1911. // Type of a dialect info record containing at least keyOSADialectName
  1912.  
  1913.  
  1914. // and keyOSADialectCode fields.
  1915.  
  1916.  
  1917. // keys for dialect info record, also used as selectors to OSAGetDialectInfo.
  1918.  
  1919.  
  1920. // Field of a typeOSADialectInfo record of typeChar.
  1921.  
  1922.  
  1923. // Field of a typeOSADialectInfo record of typeShortInteger.
  1924.  
  1925.  
  1926. // Field of a typeOSADialectInfo record of typeShortInteger.
  1927.  
  1928.  
  1929. // Field of a typeOSADialectInfo record of typeShortInteger.
  1930.  
  1931.  
  1932. ////////////////////////////////////////////////////////////////////////////////
  1933.  
  1934.  
  1935. // OSA Optional Event Handling Interface
  1936.  
  1937.  
  1938. ////////////////////////////////////////////////////////////////////////////////
  1939.  
  1940.  
  1941. // Scripting components that support the Event Handling interface have the 
  1942.  
  1943.  
  1944. // kOSASupportsEventHandling bit set in it's ComponentDescription.
  1945.  
  1946.  
  1947. ////////////////////////////////////////////////////////////////////////////////
  1948.  
  1949. extern pascal OSAError OSASetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP resumeDispatchProc, long refCon)
  1950.  FIVEWORDINLINE(0x2F3C, 8, 0x0801, 0x7000, 0xA82A);
  1951.  
  1952. // This function is used to set the ResumeDispatchProc that will be used
  1953.  
  1954.  
  1955. // by OSAExecuteEvent and OSADoEvent if either no event handler can be
  1956.  
  1957.  
  1958. // found in the context, or the context event hander "continues" control
  1959.  
  1960.  
  1961. // onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
  1962.  
  1963.  
  1964. // may also be passed to this routine indicating that the handler registered
  1965.  
  1966.  
  1967. // in the application with AEInstallEventHandler should be used, or no
  1968.  
  1969.  
  1970. // dispatch should occur, respectively.
  1971.  
  1972.  
  1973. //
  1974.  
  1975.  
  1976. // Errors:
  1977.  
  1978.  
  1979. //    badComponentInstance    invalid scripting component instance
  1980.  
  1981.  
  1982. //     errOSASystemError
  1983.  
  1984. #define kOSAUseStandardDispatch ((AEEventHandlerUPP)kAEUseStandardDispatch)
  1985.  
  1986. #define kOSANoDispatch ((AEEventHandlerUPP)kAENoDispatch)
  1987.  
  1988. enum  {
  1989.     kOSADontUsePhac                = 0x0001
  1990. };
  1991.  
  1992.  
  1993. // Special refCon constant that may be given to OSASetResumeDispatchProc
  1994.  
  1995.  
  1996. // only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
  1997.  
  1998.  
  1999. // This causes the standard dispatch to be performed, except the phac
  2000.  
  2001.  
  2002. // handler is not called.  This is useful during tinkerability, when
  2003.  
  2004.  
  2005. // the phac handler is used to lookup a context associated with an event's 
  2006.  
  2007.  
  2008. // direct parameter, and call OSAExecuteEvent or OSADoEvent.  Failure to
  2009.  
  2010.  
  2011. // bypass the phac handler would result in an infinite loop.
  2012.  
  2013. extern pascal OSAError OSAGetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP *resumeDispatchProc, long *refCon)
  2014.  FIVEWORDINLINE(0x2F3C, 8, 0x0802, 0x7000, 0xA82A);
  2015.  
  2016. // Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
  2017.  
  2018.  
  2019. // been registered, then kOSAUseStandardDispatch (the default) is returned.
  2020.  
  2021.  
  2022. //
  2023.  
  2024.  
  2025. // Errors:
  2026.  
  2027.  
  2028. //    badComponentInstance    invalid scripting component instance
  2029.  
  2030.  
  2031. //     errOSASystemError
  2032.  
  2033. extern pascal OSAError OSAExecuteEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  2034.  FIVEWORDINLINE(0x2F3C, 16, 0x0803, 0x7000, 0xA82A);
  2035.  
  2036. // This call is similar to OSAExecute except the initial command to
  2037.  
  2038.  
  2039. // execute comes in the form of an AppleEvent.  If the contextID
  2040.  
  2041.  
  2042. // defines any event handlers for that event, they are used to process
  2043.  
  2044.  
  2045. // the event.  If no event handler can be found in the context
  2046.  
  2047.  
  2048. // errAEEventNotHandled is returned.  If an event handler is found and
  2049.  
  2050.  
  2051. // the hander "continues" control onward, the ResumeDispatchProc
  2052.  
  2053.  
  2054. // (registered with OSASetResumeDispatchProc, above) is called given the
  2055.  
  2056.  
  2057. // AppleEvent.  The result is returned as a scriptValueID.
  2058.  
  2059.  
  2060. //
  2061.  
  2062.  
  2063. // Errors:
  2064.  
  2065.  
  2066. //    badComponentInstance    invalid scripting component instance
  2067.  
  2068.  
  2069. //     errOSASystemError
  2070.  
  2071.  
  2072. //     errOSAInvalidID
  2073.  
  2074.  
  2075. //     errOSAScriptError:        the executing script got an error
  2076.  
  2077.  
  2078. //     errAEEventNotHandled:    no handler for event in contextID
  2079.  
  2080.  
  2081. //
  2082.  
  2083.  
  2084. // ModeFlags:
  2085.  
  2086.  
  2087. //    kOSAModeNeverInteract
  2088.  
  2089.  
  2090. //    kOSAModeCanInteract
  2091.  
  2092.  
  2093. //    kOSAModeAlwaysInteract
  2094.  
  2095.  
  2096. //    kOSAModeCantSwitchLayer
  2097.  
  2098.  
  2099. //    kOSAModeDontReconnect
  2100.  
  2101.  
  2102. //    kOSAModeDoRecord
  2103.  
  2104. extern pascal OSAError OSADoEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, AppleEvent *reply)
  2105.  FIVEWORDINLINE(0x2F3C, 16, 0x0804, 0x7000, 0xA82A);
  2106.  
  2107. // This call is similar to OSADoScript except the initial command to
  2108.  
  2109.  
  2110. // execute comes in the form of an AppleEvent, and the result is an 
  2111.  
  2112.  
  2113. // AppleEvent reply record.  If the contextID defines any event handlers
  2114.  
  2115.  
  2116. // for that event, they are used to process the event.  If no event handler
  2117.  
  2118.  
  2119. // can be found in the context errAEEventNotHandled is returned.  If an
  2120.  
  2121.  
  2122. // event handler is found and the hander "continues" control onward, the
  2123.  
  2124.  
  2125. // ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
  2126.  
  2127.  
  2128. // called given the AppleEvent.  The result is returned in the form of an
  2129.  
  2130.  
  2131. // AppleEvent reply descriptor. If at any time the script gets an error, or
  2132.  
  2133.  
  2134. // if the ResumeDispatchProc returns a reply event indicating an error,
  2135.  
  2136.  
  2137. // then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
  2138.  
  2139.  
  2140. // should never return errOSAScriptError).  Any error result returned by
  2141.  
  2142.  
  2143. // the ResumeDispatchProc will be returned by OSADoEvent.
  2144.  
  2145.  
  2146. //
  2147.  
  2148.  
  2149. // Errors:
  2150.  
  2151.  
  2152. //    badComponentInstance    invalid scripting component instance
  2153.  
  2154.  
  2155. //     errOSASystemError
  2156.  
  2157.  
  2158. //     errOSAInvalidID
  2159.  
  2160.  
  2161. //     errAEEventNotHandled:    no handler for event in contextID
  2162.  
  2163.  
  2164. //
  2165.  
  2166.  
  2167. // ModeFlags:
  2168.  
  2169.  
  2170. //    kOSAModeNeverInteract
  2171.  
  2172.  
  2173. //    kOSAModeCanInteract
  2174.  
  2175.  
  2176. //    kOSAModeAlwaysInteract
  2177.  
  2178.  
  2179. //    kOSAModeCantSwitchLayer
  2180.  
  2181.  
  2182. //    kOSAModeDontReconnect
  2183.  
  2184.  
  2185. //    kOSAModeDoRecord
  2186.  
  2187. extern pascal OSAError OSAMakeContext(ComponentInstance scriptingComponent, const AEDesc *contextName, OSAID parentContext, OSAID *resultingContextID)
  2188.  FIVEWORDINLINE(0x2F3C, 12, 0x0805, 0x7000, 0xA82A);
  2189.  
  2190. // Makes a new empty context which may be passed to OSAExecute or 
  2191.  
  2192.  
  2193. // OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
  2194.  
  2195.  
  2196. // created. If parentContext is kOSANullScript then the resulting context
  2197.  
  2198.  
  2199. // does not inherit bindings from any other context.
  2200.  
  2201.  
  2202. //
  2203.  
  2204.  
  2205. // Errors:
  2206.  
  2207.  
  2208. //    badComponentInstance    invalid scripting component instance
  2209.  
  2210.  
  2211. //     errOSASystemError
  2212.  
  2213.  
  2214. //     errOSAInvalidID
  2215.  
  2216.  
  2217. //     errAECoercionFail:        contextName is invalid
  2218.  
  2219.  
  2220. ////////////////////////////////////////////////////////////////////////////////
  2221.  
  2222. #ifdef __cplusplus
  2223. }
  2224. #endif
  2225.  
  2226. #endif
  2227.  
  2228.